layui.config({
    base : window.ViewContextPath+"vue/js/"
}).use(['form', 'layer', 'jquery', 'table','laydate'], function () {
    var form = layui.form,
        layer = parent.layer === undefined ? layui.layer : parent.layer,
        laydate = layui.laydate,
        $ = layui.jquery;
    var table = layui.table;
    // var commUtil = layui.commUtil;
    
    //监听查询事件
    form.on("submit(searchBtn)", function (data) {
        onQuery(data);
    })

    //监听表格工具条事件
    table.on("tool(messageInfoFilter)", function (obj) {
        var rowData = obj.data; //获得当前行数据
        var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
        if ("detail" == layEvent) {
            view(rowData);
        }
    })
form.render();
    function onQuery(data) {//执行重载

        table.reload("messageInfoTable", {
            page: {
                curr: 1
            },
            where: data.field
        });
    }
  //查看
    function view(rowData) {
        if(rowData.url!=null&&rowData.url!=""){
        parent.openDiv('900px','500px',nginxpath+rowData.url,'详情');
        }else {
            parent.openDiv('900px','500px',basePath+'/system/messageInfo/loadMessageInfoOne/'+rowData.recId,'详情');
        }
        /*$(window).one("resize", function () {
            var index = layui.layer.open({
				title : "请假单详情",
				type : 2,
				skin:'layui-layer-molv',
				maxmin: true, //开启最大化最小化按钮
				offset: 't',
				content : basePath + "/service/oa/dayoff/detail?recId=" + recId, 
				area: ['950px', '600px'],
				success : function(layero, index){
//					commUtil.resizeLayer(index);
				}
			})	
	    }).resize();*/
    }
    
  //编辑
    function edit(recId) {
    	$(window).one("resize", function () {
            var index = layui.layer.open({
				title : "请假单编辑",
				type : 2,
				skin:'layui-layer-molv',
				maxmin: true, //开启最大化最小化按钮
				offset: 't',
				content : basePath + "/service/oa/dayoff/detail?recId=" + recId+"&type=edit", 
				area: ['950px', '600px'],
				success : function(layero, index){
//					commUtil.resizeLayer(index);
				}
			})	
	    }).resize();
    }

})


